/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.shoppingsystem.view.editors;

import java.awt.Component;
import javax.swing.AbstractCellEditor;
import javax.swing.ComboBoxModel;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;

/**
 *
 * @author Usuario
 */
public class JComboBoxCellEditor extends AbstractCellEditor implements TableCellEditor {

    private javax.swing.JComboBox comboBox = new javax.swing.JComboBox<>();

    @Override
    public Object getCellEditorValue() {
        return String.valueOf(comboBox.getSelectedItem());
    }

    @Override
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
        
        return comboBox;
    }

   public void setModel(ComboBoxModel model) {
        
        comboBox.setModel(model);
    }
}
